//
//  NumberView.m
//  项目三
//
//  Created by rimi on 15/10/9.
//  Copyright (c) 2015年 rimi. All rights reserved.
//

#import "NumberView.h"

@interface NumberView()

@property (nonatomic, strong) UIImageView *backgroundImage;
@property (nonatomic, strong) UIButton *chooseAllBtn;
@property (nonatomic, strong) UIButton *payBtn;
@property (nonatomic, strong) UIButton *cancelBtn;

- (void)initializeAppearence;
@end

@implementation NumberView

- (id)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self initializeAppearence];
    }
    return self;
}

- (instancetype)init {
    self = [super init];
    if (self) {
        [self initializeAppearence];
    }
    return self;
}

- (void)initializeAppearence {
    
    [self addSubview:self.backgroundImage];
    [self addSubview:self.chooseAllBtn];
    [self addSubview:self.payBtn];
    [self addSubview:self.cancelBtn];
    
}
#pragma mark - action on button
- (void)actionOnChooseBtn {
    
    
}
- (void)actionOnPayBtn {
    
    
}
- (void)actionOnCancelBtn {
    
    [UIView animateWithDuration:1.0 animations:^{
        self.alpha = 0;
    }];
    [self removeFromSuperview];
}

#pragma mark - getter
- (UIImageView *)backgroundImage {
    
    if (!_backgroundImage) {
        _backgroundImage = ({
            
            UIImageView *imageView = [[UIImageView alloc] initWithFrame:self.bounds];
            imageView.image = [UIImage imageNamed:@"灰色背景"];
            
            imageView;
        });
    }
    return _backgroundImage;
}
- (UIButton *)chooseAllBtn {
    
    if (!_chooseAllBtn) {
        _chooseAllBtn = ({
            
            UIButton *button = [[UIButton alloc] initWithFrame:DHFlexibleFrame(CGRectMake(130, 555, 143, 48))];
            [button setImage:[UIImage imageNamed:@"全选1"] forState:UIControlStateNormal];
            [button addTarget:self action:@selector(actionOnChooseBtn) forControlEvents:UIControlEventTouchUpInside];
            
            button;
            
        });
    }
    return _chooseAllBtn;
}
- (UIButton *)payBtn {
    
    if (!_payBtn) {
        _payBtn = ({
            
            UIButton *button = [[UIButton alloc] initWithFrame:DHFlexibleFrame(CGRectMake(290, 555, 143, 48))];
            [button setImage:[UIImage imageNamed:@"缴付罚款"] forState:UIControlStateNormal];
            [button addTarget:self action:@selector(actionOnPayBtn) forControlEvents:UIControlEventTouchUpInside];
            
            button;
            
        });
    }
    return _payBtn;
}
- (UIButton *)cancelBtn {
    
    if (!_cancelBtn) {
        _cancelBtn = ({
            
            UIButton *button = [[UIButton alloc] initWithFrame:DHFlexibleFrame(CGRectMake(450, 555, 143, 48))];
            [button setImage:[UIImage imageNamed:@"缴费取消"] forState:UIControlStateNormal];
            [button addTarget:self action:@selector(actionOnCancelBtn) forControlEvents:UIControlEventTouchUpInside];
            
            button;
            
        });
    }
    return _cancelBtn;
}

@end
